﻿@* --------------------------------------------------------------------------------------------------------------------
// <copyright file="EditTemplate.cshtml" company="Devbridge Group LLC">
// 
// Copyright (C) 2015,2016 Devbridge Group LLC
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/. 
// </copyright>
// 
// <summary>
// Better CMS is a publishing focused and developer friendly .NET open source CMS.
// 
// Website: https://www.bettercms.com 
// GitHub: https://github.com/devbridge/bettercms
// Email: info@bettercms.com
// </summary>
// -------------------------------------------------------------------------------------------------------------------- *@
@using BetterCms.Module.Pages
@using BetterCms.Module.Pages.Content.Resources
@using BetterCms.Module.Pages.Controllers
@using BetterCms.Module.Pages.ViewModels.Templates
@using BetterCms.Module.Root.Mvc.Helpers
@using BetterCms.Module.Root.ViewModels.Shared
@using Microsoft.Web.Mvc

@model TemplateEditViewModel
@if (Model == null)
{
    return;
}

<div class="bcms-tab-header bcms-js-tab-header">
    <div class="bcms-modal-frame-holder">
        <div class="bcms-tab-ui bcms-tab-item bcms-active" data-name="#bcms-tab-1">@PagesGlobalization.EditTemplate_BasicPropertiesTab_Title</div>
        <div class="bcms-tab-ui bcms-tab-item" data-name="#bcms-tab-2">@PagesGlobalization.EditTemplate_RegionsTab_Title</div>
        <div class="bcms-tab-ui bcms-tab-item" data-name="#bcms-tab-3">@PagesGlobalization.EditTemplate_OptionsTab_Title</div>
    </div>
</div>

<div class="bcms-modal-frame-holder">
    <div class="bcms-window-tabbed-options">
        @Html.MessagesBox("bcms-edit-template-messages")
        @using (Html.BeginForm<TemplatesController>(c => c.RegisterTemplate((TemplateEditViewModel)null), FormMethod.Post, new { @id = "bcms-template-form", @class = "bcms-ajax-form" }))
        {
            <div id="bcms-tab-1" class="bcms-tab-single">
                <div class="bcms-form-block-holder">
                    <div>
                        <div class="bcms-input-list-holder">
                            <div class="bcms-content-titles">@PagesGlobalization.Template_Title_Title</div>
                            @Html.Tooltip(PagesGlobalization.Template_Title_Tooltip_Description)
                            <div class="bcms-field-wrapper">
                                @Html.TextBoxFor(model => model.Name, new { @class = "bcms-field-text" })
                                @Html.BcmsValidationMessageFor(m => m.Name)
                            </div>
                        </div>

                        <div class="bcms-input-list-holder">
                            <div class="bcms-content-titles">@PagesGlobalization.Template_Url_Title</div>
                            @Html.Tooltip(PagesGlobalization.Template_Url_Tooltip_Description)
                            <div class="bcms-field-wrapper">
                                @Html.TextBoxFor(model => model.Url, new { @class = "bcms-field-text" })
                                @Html.BcmsValidationMessageFor(m => m.Url)
                            </div>
                        </div>

                        <div class="bcms-input-list-holder">
                            <div class="bcms-content-titles">@PagesGlobalization.TemplatePreviewImageUrl_Title</div>
                            @Html.Tooltip(PagesGlobalization.TemplatePreviewImageUrl_Tooltip_Description)
                            <div class="bcms-field-wrapper">
                                @Html.TextBoxFor(model => model.PreviewImageUrl, new { @class = "bcms-field-text" })
                                @Html.BcmsValidationMessageFor(m => m.PreviewImageUrl)
                            </div>
                        </div>
                    </div>

                    <div>
                        <div class="bcms-input-list-holder">
                            <div class="bcms-content-titles">@PagesGlobalization.TemplatePreviewImage_Title</div>
                            @Html.Tooltip(PagesGlobalization.TemplateImagePreview_Tooltip_Description)

                            <div class="bcms-preview-thumb">
                                <img id="bcms-template-preview-image" src="@Model.PreviewImageUrl" alt="" />
                                <svg id="bcms-template-no-preview" class="bcms-grid-no-preview" width="50" height="50" viewBox="-205 372 50 50" enable-background="new -205 372 50 50">
                                    <g fill="#cdcdcd">
                                        <path d="m-205 422h50v-50h-50v50m2-48h46v46h-46v-46" />
                                        <path d="m-164.3 406.2l1.4-1.4-11.5-11.5-7.7 7.6-3.6-3.6-11.5 11.5 1.4 1.4 10.1-10.1 11.1 11.1 1.4-1.4-7.5-7.5 6.3-6.2 10.1 10.1" />
                                        <path d="m-187.9 382.4c-2.8 0-5 2.2-5 5 0 2.8 2.2 5 5 5 2.8 0 5-2.2 5-5 0-2.8-2.2-5-5-5m0 2c1.7 0 3 1.4 3 3 0 1.7-1.3 3-3 3-1.6 0-3-1.3-3-3 0-1.7 1.3-3 3-3" />
                                    </g>
                                </svg>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="bcms-tab-2" class="bcms-tab-single">
                @Html.Partial("Partial/EditTemplateRegions")
            </div>

            <div id="bcms-tab-3" class="bcms-tab-single">
                @Html.Partial(PagesConstants.OptionsGridTemplate, new EditableGridViewModel())
            </div>

            @Html.HiddenFor(model => model.Id)
            @Html.HiddenFor(model => model.Version)
            @Html.HiddenSubmit()
        }
    </div>
</div>
